Modification Title: Portal System Addon: Main Menu Links Upgrade v1.0

Modification Author: Adam Clarke

Required: Portal System v4.0 @ http://www.xmbgarage.com

Last Updated: 07/25/2009

Modification Description:
This modification will update the forum links so they are loaded from header.php which means all existing hacks will be automatically added to the portal links.
This modification will provide on/off controls for the link images in the Portal Admin/Settings.

Supported Version: XMB 1.9.8 SP3

Installation Note: Before adding this modification to your forum you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy has been provided with this software package.

============================================================================================================================
=======
Step 1.
=======
==============================
Go To Admin Panel --> Insert Raw SQL
==============================

ALTER TABLE `$table_settings` ADD `portallinkimages` char(3) NOT NULL default 'on';

============================================================================================================================
=======
Step 2.
=======
=================
Edit File: header.php
=================
==========
Find Code:
==========

    $links = implode(' &nbsp; ', $links);

============
Replace With:
============

    $flinks = implode(' &nbsp; ', $links);

============================================================================================================================
=======
Step 3.
=======
================
Edit File: portal.php
================
==========
Find Code:
==========

$plinks = array();

$plinks[] = '&raquo;&nbsp;<a href="'.$boardurl.'index.php?forums"><font class="smalltxt">'.$lang['portalmainnav'].'</font></a>';

if ($SETTINGS['searchstatus'] == 'on') {
    $plinks[] = '&raquo;&nbsp;<a href="misc.php?action=search"><font class="smalltxt">'.$lang['textsearch'].'</font></a>';
}

if ($SETTINGS['faqstatus'] == 'on') {
    $plinks[] = '&raquo;&nbsp;<a href="faq.php"><font class="smalltxt">'.$lang['textfaq'].'</font></a>';
}

if ($SETTINGS['memliststatus'] == 'on') {
    $plinks[] = '&raquo;&nbsp;<a href="misc.php?action=list"><font class="smalltxt">'.$lang['textmemberlist'].'</font></a>';
}

if ($SETTINGS['todaysposts'] == 'on') {
    $plinks[] = '&raquo;&nbsp;<a href="today.php"><font class="smalltxt">'.$lang['navtodaysposts'].'</font></a>';
}

if ($SETTINGS['stats'] == 'on') {
    $plinks[] = '&raquo;&nbsp;<a href="stats.php"><font class="smalltxt">'.$lang['navstats'].'</font></a>';
}

if ($SETTINGS['bbrules'] == 'on') {
    $plinks[] = '&raquo;&nbsp;<a href="faq.php?page=forumrules"><font class="smalltxt">'.$lang['textbbrules'].'</font></a>';
}

$plinks = implode("<br />", $plinks);

============
Replace With:
============

// Portal Main Menu Links Upgrade Mod Begin
$flinks = array();
$flinks = implode('<br />', $links);
$flinks = str_replace('navtd', 'smalltext', $flinks);
if ($SETTINGS['portallinkimages'] != 'on') {
    $flinks = preg_replace('/\<img(.*?) \/\>/mi', '&raquo; ', $flinks);
}
// Portal Main Menu Links Upgrade Mod End

============================================================================================================================
=======
Step 4.
=======
==================
Edit File: cp_portal.php
==================
==========
Find Code:
==========

        $portalviewon = $portalviewoff = '';
        settingHTML('portalview', $portalviewon, $portalviewoff);

===============
Add Code Below:
===============

        // Portal Main Menu Links Upgrade Mod Begin
        $portallinkimageson = $portallinkimagesoff = '';
        settingHTML('portallinkimages', $portallinkimageson, $portallinkimagesoff);
        // Portal Main Menu Links Upgrade Mod End

==========
Find Code:
==========

        $portalviewnew = formOnOff('portalviewnew');

===============
Add Code Below:
===============

        // Portal Main Menu Links Upgrade Mod Begin
        $portallinkimagesnew = formOnOff('portallinkimagesnew');
        // Portal Main Menu Links Upgrade Mod End

==========
Find Code:
==========

        mysql_query("UPDATE ".X_PREFIX."settings SET

================
Replace Code With:
================

        mysql_query("UPDATE ".X_PREFIX."settings SET
            portallinkimages = '$portallinkimagesnew',

============================================================================================================================
=======
Step 5.
=======
========================
Edit File: lang/English.portal.php
========================
============================
Add Code To End Of File Above ?>
============================

// Portal Main Menu Links Upgrade Mod Begin
$lang['portallinkimages'] = "Show Portal main menu link images:";
// Portal Main Menu Links Upgrade Mod End

============================================================================================================================
=======
Step 6.
=======
==========================
Go To Admin Panel --> Templates
==========================
=================
Edit Template: header
=================
==========
Find Code:
==========

$links

============
Replace With:
============

$flinks

============================================================================================================================
=======
Step 7.
=======
==========================
Go To Admin Panel --> Templates
==========================
============================
Edit Template: padmin_admin_settings
============================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="50%">$lang[portaltitle]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="portaltitlenew" value="$portaltitle" size="25" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="50%">$lang[portallinkimages]</td>
<td bgcolor="$THEME[altbg2]">
<select size="1" name="portallinkimagesnew">
<option value="on" $linkimageson>$lang[texton]</option>
<option value="off" $linkimagesoff>$lang[textoff]</option>
</select></td>
</tr>

============================================================================================================================
=======
Step 8:
=======
============================================
Go To Admin Panel --> Portal Settings --> Edit Portal Blocks
============================================
===========================
Edit Portal Block: portal_main_menu
===========================
==========
Find Code:
==========

$plinks

================
Replace Code With:
================

$flinks

============================================================================================================================
Enjoy!